﻿@using TicketDesk.Domain.Model
@model TicketDesk.Domain.Model.ApplicationSetting

@section title
{
    Application Settings
}

@section scripts
{
    @Styles.Render("~/content/select2")
    @Scripts.Render("~/bundles/select2")
    @Scripts.Render("~/bundles/application-settings")

    <script type="text/javascript">

        (function () {
            window.applicationSettings.activate(null);
        })();
    </script>
}

<main>
    <div class="container">
        <fieldset>
            <!-- Form Name -->
            <legend class="col-lg-9 col-lg-offset-1 col-sm-12">
                Application settings
            </legend>

            @using (Html.BeginForm("Index", "ApplicationSettings", FormMethod.Post, new { @class = "form-horizontal" }))
            {
                <div class="col-lg-8 col-lg-offset-2  col-sm-12">
                    @Html.AntiForgeryToken()



                    <div class="panel panel-info">
                        <div class="panel-heading">
                            <h2 class="panel-title">Global permissions</h2>
                        </div>
                        <div class="panel-body ">
                            @Html.ValidationSummary(true, "", new { @class = "text-danger" })

                            @Html.HiddenFor(model => model.ApplicationName)

                            <div class="form-group">
                                <label class="col-md-4 col-sm-4 control-label">Priority</label>
                                <div class="col-md-8 col-sm-8">
                                    <label class="checkbox-inline">
                                        @Html.CheckBoxFor(model => model.Permissions.AllowInternalUsersToEditPriority, new { htmlAttributes = new { @class = "form-control" } })
                                        @Html.DisplayNameFor(model => model.Permissions.AllowInternalUsersToEditPriority)
                                    </label>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-4 col-sm-4 control-label">Tags</label>
                                <div class="col-md-8 col-sm-8">
                                    <label class="checkbox-inline">
                                        @Html.CheckBoxFor(model => model.Permissions.AllowInternalUsersToEditTags, new { htmlAttributes = new { @class = "form-control" } })
                                        @Html.DisplayNameFor(model => model.Permissions.AllowInternalUsersToEditTags)
                                    </label>
                                </div>
                            </div>
                        </div>
                        <div class="panel panel-info">
                            <div class="panel-heading">
                                <h2 class="panel-title">General Settings</h2>
                            </div>
                            <div class="panel-body ">
                                <div class="form-group">


                                   

                                    <label class="col-md-4 col-sm-4 control-label">Text Editor</label>
                                    <div class="col-md-8 col-sm-8">
                                        <div class="radio">
                                            <label class="checkbox-inline">
                                                @Html.RadioButton("DefaultTextEditorType", "summernote", (Model.ClientSettings.GetDefaultTextEditorType() == "summernote"), new { id = "IsSummernote" })
                                                Summernote (HTML Editor)
                                            </label>
                                        </div>
                                        <div class="radio">
                                            <label class="checkbox-inline">
                                                @Html.RadioButton("DefaultTextEditorType", "pagedown", (Model.ClientSettings.GetDefaultTextEditorType() == "pagedown"), new { id = "IsPagedown" })
                                                Pagedown (Markdown Editor)
                                            </label>
                                        </div>
                                        <div class="help-block">
                                            <p>
                                                Ticketdesk includes two choices for rich text editing.
                                            </p>
                                            <p>
                                                Ticketdesk will sanitize HTML content from either editor to help prevent script injection
                                                attacks. The Markdown editor is recommended, but for less technical users an HTML based editor
                                                may be more intuative.
                                            </p>
                                        </div>
                                    </div>









                                </div>
                            </div>
                        </div>
                        <div class="panel-heading">
                            <h2 class="panel-title">List settings</h2>
                        </div>
                        <div class="panel-body ">
                            <div class="form-group">
                                @Html.LabelFor(model => model.SelectLists.TicketTypesList, new { @class = "col-md-4 col-sm-4 control-label" })
                                <div class="col-md-8 col-sm-8">
                                    <input id="tickettypes" name="tickettypes" class="form-control input-sm" value="@Model.GetTicketTypes()" />
                                </div>
                            </div>
                            <div class="form-group">
                                @Html.LabelFor(model => model.SelectLists.CategoryList, new { @class = "col-md-4 col-sm-4 control-label" })
                                <div class="col-md-8 col-sm-8">
                                    <input id="categories" name="categories" class="form-control input-sm" value="@Model.GetCategories()" />
                                </div>
                            </div>
                            <div class="form-group">
                                @Html.LabelFor(model => model.SelectLists.PriorityList, new { @class = "col-md-4 col-sm-4 control-label" })
                                <div class="col-md-8 col-sm-8">
                                    <input id="priorities" name="priorities" class="form-control input-sm" value="@Model.GetPriorities()" />
                                </div>
                            </div>
                        </div>
                        <div class="panel-heading">
                            <h2 class="panel-title">Security settings</h2>
                        </div>
                        <div class="panel-body ">
                            <div class="form-group">
                                @Html.LabelFor(model => model.SecuritySettings.DefaultNewUserRoles, new { @class = "col-md-4 col-sm-4 control-label" })
                                <div class="col-md-8 col-sm-8">
                                    @Html.ListBox("defaultroles", Model.GetDefaultNewUserRolesList(), new { id = "defaultroles", @class = "form-control input-sm" })
                                </div>
                            </div>

                        </div>
                        <div class="panel-footer">
                            <div class="">
                                <button type="submit" class="btn btn-success" tabindex="10"><i class="fa fa-save"></i>&nbsp;&nbsp;Save</button>&nbsp;&nbsp;

                            </div>
                        </div>

                    </div>
                </div>
                                        }
        </fieldset>
    </div>
</main>